package cn.com.dhcc.turbo.web.controller.test;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.dhcc.app.core.base.BaseController;

@RequestMapping("/mock")
@Controller
public class HttpMockController extends BaseController {

	@RequestMapping(value = "/hello")
	@ResponseBody
	public String hello() {
		return "Hello world";
	}

	@RequestMapping(value = "/login")
	@ResponseBody
	public String login(String username, String password) {
		return "User login:" + username + "=" + password;
	}
	
	
	@RequestMapping(value = "/timeout")
	@ResponseBody
	public String timeout(int time) {
		if (time == 0) {
			time = 5000;
		}
		try {
			Thread.sleep(time);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return "the server is sleeping for " + time;
	}

}
